﻿<%@ Page Language="c#" CodeBehind="ShowDay.aspx.cs" AutoEventWireup="false" Inherits="UDS.SubModule.WorkAttendance.ShowDayPage" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
  <title>考勤日期设置</title>
  <uds:Style runat="server" Href="~/css/BasicLayout.css" />
  <script language="jscript">
  //<!--
  function Click_Cell(cell)
  {
    cell.className = (cell.className.toLowerCase()==="onduty") ? "offduty" : "onduty";
    cell.blur();
  }

  function Top_Click(cellnumber)
  {
    var table = document.getElementById("<%= dayTable.ClientID %>");
	  for(var i=0; i<table.rows.length; i++)
	  {
	    table.rows[i].cells[cellnumber].click();
	  }
  }
  
  function CollectDaySettings()
  {
    try
    {
      var hiddenField = document.getElementById("<%= hfCellStatus.ClientID %>");
      hiddenField.value = "";
      
      var table = document.getElementById("<%= dayTable.ClientID %>");
      var arr = [];
      for(var i=0; i<table.rows.length; i++)
      {
        var row = table.rows[i];
        for(var j=0; j<row.cells.length; j++)
        {
          var cell = row.cells[j];
          var dayValue = parseInt(cell.getAttribute("DayValue"),10);
          if(!isNaN(dayValue) && dayValue>0)
          {
            arr[arr.length] = dayValue + '-' + ((cell.className.toLowerCase()==="onduty") ? "true" : "false");
          }
        }
      }
      
      hiddenField.value = arr.join(',');
      return true;
    }
    catch(ex)
    {
      alert("Error: " + ex.message);
      return false;
    }
    return true;
  }
  //-->
  </script>
  <style type="text/css">
    .onduty, td.onduty, .offduty, td.offduty, .title_cell, td.title_cell { width: 100px; text-align: center; vertical-align: middle; height: 30px; cursor: pointer; }
    .title_cell, td.title_cell { background-color: #e8f4ff; color: #000; font-weight: bold; }
    .onduty, td.onduty { background-color: #ebffe5; }
    .offduty, td.offduty { background-color: #ffffef; font-style: italic; }
    .day_table { width: 700px; text-align: center; border: solid 1px #666; border-collapse: collapse; table-layout: fixed; }
    .day_table td { border: solid 1px #ccc; }
  </style>
</head>
<body>
  <form method="post" runat="server" onsubmit="return(CollectDaySettings());">
    <uds:PageTitle runat="server" HintImage="~/DataImages/page.gif" Title="考勤设置" />
    <div style="text-align: center; padding: 10px;">
      <div style="width: 700px;">
        <table runat="server" id="dayTable" cellspacing="0" cellpadding="0" border="1" class="gbtext day_table">
          <tr>
            <td class="title_cell" onclick="Top_Click(0)" onmouseover="this.title='点击改变整列'">星期一</td>
            <td class="title_cell" onclick="Top_Click(1)" onmouseover="this.title='点击改变整列'">星期二</td>
            <td class="title_cell" onclick="Top_Click(2)" onmouseover="this.title='点击改变整列'">星期三</td>
            <td class="title_cell" onclick="Top_Click(3)" onmouseover="this.title='点击改变整列'">星期四</td>
            <td class="title_cell" onclick="Top_Click(4)" onmouseover="this.title='点击改变整列'">星期五</td>
            <td class="title_cell" onclick="Top_Click(5)" onmouseover="this.title='点击改变整列'">星期六</td>
            <td class="title_cell" onclick="Top_Click(6)" onmouseover="this.title='点击改变整列'">星期日</td>
          </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; margin: 20px 0;" width="100%">
          <tr height="30">
            <td>
              <table cellspacing="0" cellpadding="0" class="gbtext day_table" style="width: 200px;" border="1">
                <tr>
                  <td class="onduty">工作日</td>
                  <td class="offduty">休息日</td>
                </tr>
              </table>
            </td>
          </tr>
          <tr height="30">
            <td class="GbText" align="center">
              <asp:Button ID="btnSubmit" runat="server" Text=" 确 认 " CssClass="buttoncss" />
              <asp:HiddenField runat="server" ID="hfCellStatus" /><input type="button" class="buttoncss" value="关闭窗口" onclick="window.close();" /> </td>
          </tr>
        </table>
      </div>
    </div>
  </form>
</body>
</html>
